<script setup lang="ts">
import useLocale from './hooks/useLocale' // 国际化hook
const {
  i18n: { t },
  currentLocale, //当前国际化
  changeLocale, // 修改国际化
} = useLocale()

// 切换语言
const switchLang = () => {
  if (currentLocale.value == 'zh') {
    changeLocale('en')
  } else {
    changeLocale('zh')
  }
}
</script>

<template>
  <div>
    {{ t("say") }}
    {{ t("world") }}
    <button @click="switchLang">
      {{ t('navbar.action.locale') }}
    </button>

  </div>
</template>

<style scoped>
.logo {
  height: 6em;
  padding: 1.5em;
  will-change: filter;
  transition: filter 300ms;
}

.logo:hover {
  filter: drop-shadow(0 0 2em #646cffaa);
}

.logo.vue:hover {
  filter: drop-shadow(0 0 2em #42b883aa);
}
</style>
